<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        function getDog (name,gender){
            let obj = {} ; 
            obj.name = name ; 
            obj.gender = gender ;
            obj.bark = function(){
                console.log("叫一次") ;
            }
            return obj  ;
        }
        let daHuang = getDog("大黄","公");
        let xiaoHei = getDog("小黑","公");
        console.log(xiaoHei);
        console.log(daHuang);
        daHuang.bark();
        setInterval(()=>{xiaoHei.bark();},1000)
    </script>
</body>
</html>